package com.flf;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

public class ImageAdapter extends BaseAdapter{

	private Context context;
	private int[] picIds = {R.drawable.pic1,R.drawable.pic2,R.drawable.pic3,R.drawable.pic4};
	
	public ImageAdapter(Context context){
		this.context = context;
	}
	
	public int getCount() {
		// TODO Auto-generated method stub
		return picIds.length;
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ImageView iv = new ImageView(context);
		iv.setImageResource(picIds[position]);
		iv.setScaleType(ScaleType.MATRIX);
		iv.setLayoutParams(new Gallery.LayoutParams(160, 160));
		return iv;
	}

}
